﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HTML5.Ajax
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string tag = Request["tag"] ?? string.Empty;

            if (tag == "get")
            {
                string id = Request["id"] ?? string.Empty;
                switch (id)
                {
                    case "1":
                        List<Person> list = new List<Person>();
                        for (int i = 0; i < 1000; i++)
                        {
                            Person p = new Person { name = i.ToString(), age = i, sex = false };
                            list.Add(p);
                        }
                        Response.Write("[{name:'" + id + "'}]");
                        break;
                    case "2":
                        List<Person> list1 = new List<Person>();
                        for (int i = 0; i < 1000; i++)
                        {
                            Person p = new Person { name = i.ToString(), age = i, sex = false };
                            list1.Add(p);
                        }
                        list1.ToArray();
                        Response.Write("[{name:'" + id + "'}]");
                        break;
                    case "3":
                        List<Person> list2 = new List<Person>();
                        for (int i = 0; i < 10000; i++)
                        {
                            Person p = new Person { name = i.ToString(), age = i, sex = false };
                            list2.Add(p);
                        }
                        list2.ToArray();
                        Response.Write("[{name:'" + id + "'}]");
                        break;
                }
            }
        }
    }

    public class Person
    {
        public string name { get; set; }
        public int age { get; set; }
        public bool sex { get; set; }
    }
}